package com.jack.xiaoer.config;

import com.baomidou.mybatisplus.core.injector.ISqlInjector;
import com.baomidou.mybatisplus.extension.injector.LogicSqlInjector;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.context.annotation.*;
import org.springframework.context.support.PropertySourcesPlaceholderConfigurer;
import org.springframework.mail.MailSender;
import org.springframework.mail.javamail.JavaMailSenderImpl;

/**
 * @author JackarooZhang
 * @date 2018/6/18 10:32
 */
@Configuration
@ComponentScan(basePackages = {"com.jack.xiaoer.service", "com.jack.xiaoer.dao"}) // 配置Bean的扫描路径
@MapperScan(basePackages = "com.jack.dao") // 配置Mapper接口的位置
@PropertySource(value = {"classpath:datasource.properties"}) // 获取Properties属性
@ImportResource({"classpath:spring-dao.xml"}) // 引入XML配置
public class ServiceRootConfig {

    @Bean
    public static PropertySourcesPlaceholderConfigurer placeholderConfigurer() {
        return new PropertySourcesPlaceholderConfigurer();
    }

    @Bean
    public MailSender mailSender() {
        JavaMailSenderImpl mailSender = new JavaMailSenderImpl();
        mailSender.setHost("smtp.163.com");
        mailSender.setPort(25);
        mailSender.setUsername("jackaroozz@163.com");
        mailSender.setPassword("zjl77582581314");
        return mailSender;
    }

}
